<?php
/*
 * 主要功能: 模板哈
 *
 * dreamxyp(QQ:31996798) - PHP - class.tpl.php
 * coding:夏一平
 * 創建時間:2006-11-28
 */
 class tpl
 {
 	static protected $dir = TPL_ROOT_DIR;
 	static protected $data;
 	
 	static public function assign($key,$vars)
 	{
 		if(self::$data[$key])
 		{
 			self::$data[$key] = &array_merge_recursive(self::$data[$key],&$vars);
 		}else
 		{
 			self::$data[$key] = &$vars;
 		}
 	}
	static public function import($tpl)
	{
		global $scfg;
		if(count(self::$data))
		{
			extract(self::$data);
		}
		include self::$dir.$tpl;
	}
 	static public function display($tpl,&$vars=array())
 	{
 		global $scfg;
		if(count(self::$data))
		{
			extract(array_merge_recursive(self::$data,&$vars));
		}else
		{
			extract(&$vars);
		}
		include self::$dir.$tpl;
 	}
 }
?>
